package com.example.contentProvider;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class DatabaseHelper extends SQLiteOpenHelper {

	public DatabaseHelper(Context context) {
		super(context, NoteProviderMetaData.DATABASE_NAME, null,
				NoteProviderMetaData.DATABASE_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		Log.e("DatabaseHelper", "create table: "
				+ NoteProviderMetaData.NoteTableMetaData.SQL_CREATE_TABLE);
		db.execSQL(NoteProviderMetaData.NoteTableMetaData.SQL_CREATE_TABLE);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS "
				+ NoteProviderMetaData.NoteTableMetaData.TABLE_NAME);
		onCreate(db);
	}

}